home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_HDF.idb / usr / freeware / include / hdf / hdfi.h.z / hdfi.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  42.7 KB  |  1,330 lines

  1. /****************************************************************************
  2.  * NCSA HDF                                                                 *
  3.  * Software Development Group                                               *
  4.  * National Center for Supercomputing Applications                          *
  5.  * University of Illinois at Urbana-Champaign                               *
  6.  * 605 E. Springfield, Champaign IL 61820                                   *
  7.  *                                                                          *
  8.  * For conditions of distribution and use, see the accompanying             *
  9.  * hdf/COPYING file.                                                        *
  10.  *                                                                          *
  11.  ****************************************************************************/
  12.  
  13. /* $Id: hdfi.h,v 1.125 1998/02/23 16:29:59 acheng Exp $ */
  14.  
  15. #ifndef HDFI_H
  16. #define HDFI_H
  17.  
  18. #ifdef GOT_MACHINE
  19. #undef GOT_MACHINE
  20. #endif
  21.  
  22. /*--------------------------------------------------------------------------*/
  23. /*                              MT/NT constants                             */
  24. /*  Four MT nibbles represent double, float, int, uchar (from most          */
  25. /*      significant to least significant).                                  */
  26. /*  Each "column" in the "table" below is essentially independant of the    */
  27. /*      other "columns", for example the CONVEXNATIVE entry means that the  */
  28. /*      floating point formats are in Convex native format but the integers */
  29. /*      are big-endian and standard sizes                                   */
  30. /*  If you add another value to this "table", you need to add another       */
  31. /*      DFNTF_xxx entry in hntdefs.h                                        */
  32. /*  The values for each nibble are:                                         */
  33. /*      1 - Big Endian                                                      */
  34. /*          (i.e. Big-Endian, 32-bit architecture w/IEEE Floats)            */
  35. /*      2 - VAX                                                             */
  36. /*          (i.e. Middle-Endian, 32-bit architecture w/VAX Floats)          */
  37. /*      3 - Cray                                                            */
  38. /*          (i.e. Big-Endian, all 64-bit architecture w/Cray Floats)        */
  39. /*      4 - Little Endian                                                   */
  40. /*          (i.e. Little-Endian, 32-bit architecture w/IEEE Floats)         */
  41. /*      5 - Convex                                                          */
  42. /*          (i.e. Big-Endian, 32-bit architecture w/Convex Native Floats)   */
  43. /*      6 - Fujitsu VP                                                      */
  44. /*          (i.e. Big-Endian, 32-bit architecture w/Fujitsu Native Floats)  */
  45. /*      7 - Cray MPP                                                        */
  46. /*          (i.e. Big-Endian, 32-bit architecture w/IEEE Floats, but no 16-bit type)            */
  47. /*      8 - Cray IEEE                                                       */
  48. /*          (i.e. Big-Endian, all 64-bit architecture w/IEEE Floats)        */
  49. /*--------------------------------------------------------------------------*/
  50. #define     DFMT_SUN            0x1111
  51. #define     DFMT_ALLIANT        0x1111
  52. #define     DFMT_IRIX           0x1111
  53. #define     DFMT_APOLLO         0x1111
  54. #define     DFMT_IBM6000        0x1111
  55. #define     DFMT_HP9000         0x1111
  56. #define     DFMT_CONVEXNATIVE   0x5511
  57. #define     DFMT_CONVEX         0x1111
  58. #define     DFMT_UNICOS         0x3331
  59. #define     DFMT_UNICOSIEEE     0x1831
  60. #define     DFMT_CTSS           0x3331
  61. #define     DFMT_VAX            0x2221
  62. #define     DFMT_MIPSEL         0x4441
  63. #define     DFMT_PC             0x4441
  64. #define     DFMT_MAC            0x1111
  65. #define     DFMT_SUN386         0x4441
  66. #define     DFMT_NEXT           0x1111
  67. #define     DFMT_MOTOROLA       0x1111
  68. #define     DFMT_ALPHA          0x4441
  69. #define     DFMT_VP             0x6611
  70. #define     DFMT_I860           0x4441
  71. #define     DFMT_CRAYMPP        0x1171
  72.  
  73. /* I/O library constants */
  74. #define UNIXUNBUFIO 1
  75. #define UNIXBUFIO   2
  76. #define MACIO       3
  77. #define PCIO        4    /* 16-bit MS-DOS File I/O (deprecated) */
  78. #define WINIO       5    /* 16-bit Windows File I/O (deprecated) */
  79. #define PAGEBUFIO   6    /* page buffering - fmpool */
  80. #define WINNTIO     7    /* 32-bit Windows File I/O (deprecated, WinNT now uses UNIXBUFIO) */ 
  81.  
  82. /* IBM RS6000 AIX hack */
  83. #if defined(IBM6000) || defined(_AIX)
  84. #define _POSIX_SOURCE
  85. #endif 
  86.  
  87. /* Standard header files needed all the time */
  88. #include <stdio.h>
  89. #include <stdlib.h>
  90. #include <limits.h>
  91. #include <string.h>
  92.  
  93. /* PABLO support files */
  94. #ifdef HAVE_PABLO
  95. #define IOTRACE
  96. #include "IOTrace.h"
  97. #endif  /* HAVE_PABLO */
  98.  
  99. /*-------------------------------------------------------------------------
  100.  * Define options for each platform
  101.  *-------------------------------------------------------------------------*/
  102.  
  103. /*
  104.  * Meaning of each defined macros (not completed yet)
  105.  *
  106.  * BIG_LONGS--Define when long is not "equal" to int32.  True in cases
  107.  *      where (int32 *) is not compatible with (long *).  Should
  108.  *      be renamed as LONGNEINT32.
  109.  */
  110.  
  111. #if (defined(SUN) || defined(sun) || defined(__sun__) || defined(__SUNPRO_C)) & !defined(__i386)
  112. #ifdef __STDC__
  113. #define ANSISUN
  114. #else /* __STDC__ */
  115. #define KNRSUN
  116. #endif /* __STDC__ */
  117. #endif /* SUN || sun */
  118.  
  119. #if defined(ANSISUN)
  120.  
  121. #if !defined(SUN)
  122. #define SUN
  123. #endif
  124.  
  125. #ifdef GOT_MACHINE
  126. If you get an error on this line more than one machine type has been defined.
  127. Please check your Makefile.
  128. #endif
  129. #define GOT_MACHINE
  130.  
  131. #include <unistd.h>                 /* for some file I/O stuff */
  132. #include <sys/time.h>
  133. #include <sys/file.h>               /* for unbuffered i/o stuff */
  134. #include <sys/stat.h>
  135. #define DF_MT             DFMT_SUN
  136. typedef void              VOID;
  137. typedef void              *VOIDP;
  138. typedef char              *_fcd;
  139. typedef char              char8;
  140. typedef unsigned char     uchar8;
  141. typedef char              int8;
  142. typedef unsigned char     uint8;
  143. typedef short int         int16;
  144. typedef unsigned short int uint16;
  145. typedef long int          int32;
  146. typedef unsigned long int uint32;
  147. typedef int               intn;
  148. typedef unsigned int      uintn;
  149. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  150. typedef float             float32;
  151. typedef double            float64;
  152. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  153. #define FNAME_POST_UNDERSCORE
  154. #define _fcdtocp(desc) (desc)
  155. #ifdef  HAVE_FMPOOL
  156. #define FILELIB PAGEBUFIO  /* enable page buffering */
  157. #else
  158. #define FILELIB UNIXBUFIO
  159. #endif
  160.  
  161. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  162.  
  163. /* Determine the memory manager we are going to use. Valid values are: */
  164. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  165. /*  what each does */
  166. #define JMEMSYS         MEM_ANSI
  167. #define HAVE_STDC
  168. #define INCLUDES_ARE_ANSI
  169.  
  170. #endif /* ANSISUN */
  171.  
  172. #if defined(KNRSUN)
  173.  
  174. #if !defined(SUN)
  175. #define SUN
  176. #endif
  177.  
  178. #ifdef GOT_MACHINE
  179. If you get an error on this line more than one machine type has been defined.
  180. Please check your Makefile.
  181. #endif
  182. #define GOT_MACHINE
  183.  
  184. #   define BSD
  185. #define DUMBCC     /* because it is.  for later use in macros */
  186. #ifndef __GNUC__
  187. #include <memory.h>
  188. #endif /* __GNUC__ */
  189. #include <unistd.h>
  190. #include <sys/file.h>               /* for unbuffered i/o stuff */
  191. #include <sys/stat.h>
  192. #define DF_MT             DFMT_SUN
  193. typedef void              VOID;
  194. typedef char              *VOIDP;
  195. typedef char              *_fcd;
  196. typedef char              char8;
  197. typedef unsigned char     uchar8;
  198. typedef char              int8;
  199. typedef unsigned char     uint8;
  200. typedef short int         int16;
  201. typedef unsigned short int uint16;
  202. typedef long int          int32;
  203. typedef unsigned long int uint32;
  204. typedef int               intn;
  205. typedef unsigned int      uintn;
  206. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  207. typedef float             float32;
  208. typedef double            float64;
  209. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  210. #define FNAME_POST_UNDERSCORE
  211. #define _fcdtocp(desc) (desc)
  212. #ifdef  HAVE_FMPOOL
  213. #define FILELIB PAGEBUFIO  /* enable page buffering */
  214. #else
  215. #define FILELIB UNIXBUFIO
  216. #endif
  217.  
  218. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  219.  
  220. /* Determine the memory manager we are going to use. Valid values are: */
  221. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  222. /*  what each does */
  223. #define JMEMSYS         MEM_ANSI
  224.  
  225. #ifdef __GNUC__
  226. #define HAVE_STDC
  227. #define INCLUDES_ARE_ANSI
  228. #endif
  229.  
  230. #endif /* SUN */
  231.  
  232.  
  233. #if defined(IBM6000) || defined(_AIX)
  234.  
  235. #ifndef IBM6000
  236. #define IBM6000
  237. #endif
  238.  
  239. #ifdef GOT_MACHINE
  240. If you get an error on this line more than one machine type has been defined.
  241. Please check your Makefile.
  242. #endif
  243. #define GOT_MACHINE
  244.  
  245. #   define BSD
  246.  
  247. #ifndef __GNUC__
  248. #include <memory.h>
  249. #endif /* __GNUC__ */
  250. #include <sys/file.h>               /* for unbuffered i/o stuff */
  251. #include <sys/stat.h>
  252. #define DF_MT             DFMT_IBM6000
  253. typedef void              VOID;
  254. typedef void              *VOIDP;
  255. typedef char              *_fcd;
  256. typedef char              char8;
  257. typedef unsigned char     uchar8;
  258. typedef char              int8;
  259. typedef unsigned char     uint8;
  260. typedef short int         int16;
  261. typedef unsigned short int uint16;
  262. typedef long int          int32;
  263. typedef unsigned long int uint32;
  264. typedef int               intn;
  265. typedef unsigned int      uintn;
  266. typedef float             float32;
  267. typedef double            float64;
  268. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  269. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  270. #define _fcdtocp(desc) (desc)
  271. #ifdef  HAVE_FMPOOL
  272. #define FILELIB PAGEBUFIO  /* enable page buffering */
  273. #else
  274. #define FILELIB UNIXBUFIO
  275. #endif
  276.  
  277. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  278.  
  279. /* Determine the memory manager we are going to use. Valid values are: */
  280. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  281. /*  what each does */
  282. #define JMEMSYS         MEM_ANSI
  283.  
  284. #define HAVE_STDC
  285. #define INCLUDES_ARE_ANSI
  286.  
  287. #endif /* IBM6000 */
  288.  
  289. #if defined(HP9000) || (!defined(__convexc__) && (defined(hpux) || defined(__hpux)))
  290.  
  291. #ifndef HP9000
  292. #define HP9000
  293. #endif
  294.  
  295. #ifdef GOT_MACHINE
  296. If you get an error on this line more than one machine type has been defined.
  297. Please check your Makefile.
  298. #endif
  299. #define GOT_MACHINE
  300.  
  301. #define HAVE_UNISTD_H  /* unistd.h - close, fork,..etc */
  302.  
  303. #   define BSD
  304. #ifndef __GNUC__
  305. #include <memory.h>
  306. #endif /* __GNUC__ */
  307. #include <sys/file.h>               /* for unbuffered i/o stuff */
  308. #include <sys/stat.h>
  309. #define DF_MT             DFMT_HP9000
  310. typedef void              VOID;
  311. typedef void              *VOIDP;
  312. typedef char              *_fcd;
  313. typedef char              char8;
  314. typedef unsigned char     uchar8;
  315. typedef char              int8;
  316. typedef unsigned char     uint8;
  317. typedef short int         int16;
  318. typedef unsigned short int uint16;
  319. typedef long int          int32;
  320. typedef unsigned long int uint32;
  321. typedef int               intn;
  322. typedef unsigned int      uintn;
  323. typedef float             float32;
  324. typedef double            float64;
  325. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  326. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  327. #define _fcdtocp(desc) (desc)
  328. #ifdef  HAVE_FMPOOL
  329. #define FILELIB PAGEBUFIO  /* enable page buffering */
  330. #else
  331. #define FILELIB UNIXBUFIO
  332. #endif
  333.  
  334. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  335.  
  336. /* Determine the memory manager we are going to use. Valid values are: */
  337. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  338. /*  what each does */
  339. #define JMEMSYS         MEM_ANSI
  340.  
  341. #endif /* HP9000 */
  342.  
  343.  
  344. #if defined(IRIX) || defined(IRIS4) || defined(sgi) || defined(__sgi__) || defined(__sgi)
  345.  
  346. #ifndef IRIX
  347. #define IRIX
  348. #endif
  349.  
  350. #if (_MIPS_SZLONG == 64)
  351. /* IRIX 64 bits objects.  It is nearly the same as the conventional
  352.  * 32 bits objects.  Let them share IRIX definitions for now.
  353.  */
  354. #define IRIX64
  355. #endif
  356.  
  357.  
  358. #ifdef GOT_MACHINE
  359. If you get an error on this line more than one machine type has been defined.
  360. Please check your Makefile.
  361. #endif
  362. #define GOT_MACHINE 1
  363.  
  364. #   define BSD
  365. #ifndef __GNUC__
  366. #include <memory.h>
  367. #endif /* __GNUC__ */
  368. #include <sys/file.h>               /* for unbuffered i/o stuff */
  369. #include <sys/stat.h>
  370. #define DF_MT              DFMT_IRIX
  371. typedef void               VOID;
  372. typedef void               *VOIDP;
  373. typedef char               *_fcd;
  374. typedef signed char        char8;
  375. typedef unsigned char      uchar8;
  376. typedef signed char        int8;
  377. typedef unsigned char      uint8;
  378. typedef short int          int16;
  379. typedef unsigned short int uint16;
  380. typedef int                int32;
  381. typedef unsigned int       uint32;
  382. typedef int                intn;
  383. typedef unsigned int       uintn;
  384. typedef float              float32;
  385. typedef double             float64;
  386. typedef int                intf;     /* size of INTEGERs in Fortran compiler */
  387. typedef long               hdf_pint_t;   /* an integer the same size as a pointer */
  388. #define FNAME_POST_UNDERSCORE
  389. #define _fcdtocp(desc) (desc)
  390. #ifdef  HAVE_FMPOOL
  391. #define FILELIB PAGEBUFIO  /* enable page buffering */
  392. #else
  393. #define FILELIB UNIXBUFIO
  394. #endif
  395. #ifdef IRIX64
  396. #define BIG_LONGS
  397. #endif
  398.  
  399.  
  400. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  401.  
  402. /* Determine the memory manager we are going to use. Valid values are: */
  403. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  404. /*  what each does */
  405. #define JMEMSYS         MEM_ANSI
  406.  
  407. #define HAVE_STDC
  408. #define INCLUDES_ARE_ANSI
  409.  
  410. #endif /* IRIX */
  411.  
  412. #if (defined(UNICOS) || defined(_UNICOS)) && !defined(_CRAYMPP)
  413.  
  414. #ifndef UNICOS
  415. #define UNICOS
  416. #endif
  417.  
  418. #ifdef GOT_MACHINE
  419. If you get an error on this line more than one machine type has been defined.
  420. Please check your Makefile.
  421. #endif
  422. #define GOT_MACHINE 1
  423.  
  424. #include <memory.h>
  425. #include <fortran.h>
  426. #ifndef O_RDONLY
  427. #include <fcntl.h>              /* for unbuffered i/o stuff */
  428. #define L_INCR  1
  429. #include <sys/stat.h>
  430. #endif /*O_RDONLY*/
  431.  
  432. #ifdef _CRAYIEEE
  433. #define DF_MT   DFMT_UNICOSIEEE
  434. #else
  435. #define DF_MT   DFMT_UNICOS
  436. #endif
  437. typedef void            VOID;
  438. typedef void            *VOIDP;
  439. #ifdef OLD_WAY /* May need to be included on other machines than the C-90 */
  440. typedef char            *_fcd;
  441. #endif /* OLD_WAY */
  442. typedef signed char     char8;
  443. typedef unsigned char   uchar8;
  444. typedef signed char     int8;
  445. typedef unsigned char   uint8;
  446. typedef int             int16;
  447. typedef unsigned int    uint16;
  448. typedef int             int32;
  449. typedef unsigned int    uint32;
  450. typedef int             intn;
  451. typedef unsigned int    uintn;
  452. typedef float           float32;
  453. typedef double          float64;
  454. typedef int             intf;     /* size of INTEGERs in Fortran compiler */
  455. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  456.  
  457. #define DF_CAPFNAMES            /* fortran names are in all caps */
  458. #ifdef  HAVE_FMPOOL
  459. #define FILELIB PAGEBUFIO  /* enable page buffering */
  460. #else
  461. #define FILELIB UNIXBUFIO
  462. #endif
  463.  
  464. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  465.  
  466. /* Determine the memory manager we are going to use. Valid values are: */
  467. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  468. /*  what each does */
  469. #define JMEMSYS         MEM_ANSI
  470. #define RIGHT_SHIFT_IS_UNSIGNED
  471. #define CHAR_IS_UNSIGNED
  472.  
  473. #endif /* UNICOS */
  474.  
  475. #if defined(_CRAYMPP)
  476.  
  477. #ifndef CRAYMPP
  478. #define CRAYMPP
  479. #endif
  480.  
  481. #ifdef GOT_MACHINE
  482. If you get an error on this line more than one machine type has been defined.
  483. Please check your Makefile.
  484. #endif
  485. #define GOT_MACHINE 1
  486.  
  487. #include <string.h>
  488. #include <limits.h>
  489. #include <memory.h>
  490. #include <fortran.h>
  491. #ifndef O_RDONLY
  492. #include <fcntl.h>              /* for unbuffered i/o stuff */
  493. #define L_INCR  1
  494. #include <sys/stat.h>
  495. #endif /*O_RDONLY*/
  496.  
  497. #define DF_MT   DFMT_CRAYMPP
  498. typedef void            VOID;
  499. typedef void            *VOIDP;
  500. #ifdef OLD_WAY /* May need to be included on other machines than the C-90 */
  501. typedef char            *_fcd;
  502. #endif /* OLD_WAY */
  503. typedef signed char     char8;
  504. typedef unsigned char   uchar8;
  505. typedef signed char     int8;
  506. typedef unsigned char   uint8;
  507. typedef short           int16;
  508. typedef unsigned short  uint16;
  509. typedef short           int32;
  510. typedef unsigned short  uint32;
  511. typedef int             intn;
  512. typedef unsigned int    uintn;
  513. typedef float           float32;
  514. typedef double          float64;
  515. typedef int             intf;     /* size of INTEGERs in Fortran compiler */
  516. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  517.  
  518. #define _HUGE              /* This should only be defined to a value on the PC */
  519. #define DF_CAPFNAMES            /* fortran names are in all caps */
  520. #ifdef  HAVE_FMPOOL
  521. #define FILELIB PAGEBUFIO  /* enable page buffering */
  522. #else
  523. #define FILELIB UNIXBUFIO
  524. #endif
  525.  
  526. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  527.  
  528. /* Determine the memory manager we are going to use. Valid values are: */
  529. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  530. /*  what each does */
  531. #define JMEMSYS         MEM_ANSI
  532. #define RIGHT_SHIFT_IS_UNSIGNED
  533. #define CHAR_IS_UNSIGNED
  534.  
  535. #endif /* CRAYMPP */
  536.  
  537. #if defined(VMS) || defined(vms)
  538.  
  539. #ifdef GOT_MACHINE
  540. If you get an error on this line more than one machine type has been defined.
  541. Please check your Makefile.
  542. #endif
  543. #define GOT_MACHINE 1
  544. #include <file.h>               /* for unbuffered i/o stuff */
  545. #include <sys/stat.h>
  546. #define DF_MT              DFMT_VAX
  547. typedef void               VOID;
  548. typedef void               *VOIDP;
  549. typedef char               *_fcd;
  550. typedef char               char8;
  551. typedef unsigned char      uchar8;
  552. typedef char               int8;
  553. typedef unsigned char      uint8;
  554. typedef short int          int16;
  555. typedef unsigned short int uint16;
  556. #ifdef __alpha
  557. typedef int                int32;
  558. typedef unsigned int       uint32;
  559. typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
  560. #else
  561. typedef long int           int32;
  562. typedef unsigned long int  uint32;
  563. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  564. #endif
  565. typedef int                intn;
  566. typedef unsigned int       uintn;
  567. typedef float              float32;
  568. typedef double             float64;
  569. typedef int                intf;     /* size of INTEGERs in Fortran compiler */
  570. #define _fcdtocp(desc)  ((char *) *((char **) &desc[4]))
  571.  
  572. /* 
  573.   Redef a couple of C routine names to avoid conflicts
  574.   since the VMS link command is case-insensitive
  575. */
  576. #define FILELIB UNIXBUFIO
  577. #define DF_CAPFNAMES            /* fortran names are in all caps */
  578. #include "dfivms.h"
  579.  
  580.  
  581. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  582.  
  583. /* Determine the memory manager we are going to use. Valid values are: */
  584. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  585. /*  what each does */
  586. #define JMEMSYS         MEM_ANSI
  587.  
  588. #endif /* VMS */
  589.  
  590. #if defined(CONVEX) || defined(CONVEXNATIVE) || defined(__convexc__)
  591.  
  592. #ifndef CONVEX
  593. #define CONVEX
  594. #endif
  595.  
  596. #ifdef GOT_MACHINE
  597. If you get an error on this line more than one machine type has been defined.
  598. Please check your Makefile.
  599. #endif
  600. #define GOT_MACHINE
  601.  
  602. #include <sys/types.h>
  603. #include <sys/stat.h>
  604. /* For Convex machines with native format floats */
  605. #ifdef CONVEXNATIVE
  606. #define DF_MT             DFMT_CONVEXNATIVE
  607. #else
  608. #define DF_MT             DFMT_CONVEX
  609. #endif
  610. typedef void              VOID;
  611. typedef void              *VOIDP;
  612. typedef char              *_fcd;
  613. typedef char              char8;
  614. typedef unsigned char     uchar8;
  615. typedef char              int8;
  616. typedef unsigned char     uint8;
  617. typedef short int         int16;
  618. typedef unsigned short int uint16;
  619. typedef long int          int32;
  620. typedef unsigned long int uint32;
  621. typedef int               intn;
  622. typedef unsigned int      uintn;
  623. typedef float             float32;
  624. typedef double            float64;
  625. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  626. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  627. #define _fcdtocp(desc) (desc)
  628. #ifdef  HAVE_FMPOOL
  629. #define FILELIB PAGEBUFIO  /* enable page buffering */
  630. #else
  631. #define FILELIB UNIXBUFIO
  632. #endif
  633.  
  634. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  635.  
  636. /* Determine the memory manager we are going to use. Valid values are: */
  637. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  638. /*  what each does */
  639. #define JMEMSYS         MEM_ANSI
  640. #define RIGHT_SHIFT_IS_UNSIGNED
  641. #define INCLUDES_ARE_ANSI
  642. #define HAVE_STDC
  643.  
  644. #endif /* CONVEX */
  645.  
  646.  
  647. #if defined(MIPSEL) || ((defined(mips) || defined(__mips)) && (defined(ultrix) || defined(__ultrix)))
  648.  
  649. #ifndef MIPSEL
  650. #define MIPSEL
  651. #endif
  652.  
  653. #ifdef GOT_MACHINE
  654. If you get an error on this line more than one machine type has been defined.
  655. Please check your Makefile.
  656. #endif
  657. #define GOT_MACHINE 1
  658.  
  659. #ifndef __GNUC__
  660. #define DUMBCC     /* because it is.  for later use in macros */
  661. #endif /* __GNUC__ */
  662.  
  663. #include <sys/types.h>
  664. #include <sys/file.h>               /* for unbuffered i/o stuff */
  665. #include <sys/stat.h>
  666. #define DF_MT   DFMT_MIPSEL
  667. typedef void            VOID;
  668. typedef void            *VOIDP;
  669. typedef char            *_fcd;
  670. typedef char            char8;
  671. typedef unsigned char   uchar8;
  672. typedef char            int8;
  673. typedef unsigned char   uint8;
  674. typedef short           int16;
  675. typedef unsigned short  uint16;
  676. typedef int             int32;
  677. typedef unsigned int    uint32;
  678. typedef int             intn;
  679. typedef unsigned int    uintn;
  680. typedef float           float32;
  681. typedef double          float64;
  682. typedef int             intf;     /* size of INTEGERs in Fortran compiler */
  683. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  684. #define _fcdtocp(desc) (desc)
  685. #define FNAME_POST_UNDERSCORE
  686. #ifdef  HAVE_FMPOOL
  687. #define FILELIB PAGEBUFIO  /* enable page buffering */
  688. #else
  689. #define FILELIB UNIXBUFIO
  690. #endif
  691.  
  692. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  693.  
  694. /* Determine the memory manager we are going to use. Valid values are: */
  695. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  696. /*  what each does */
  697. #define JMEMSYS         MEM_ANSI
  698.  
  699. #endif /* MIPSEL */
  700.  
  701. #if defined(MAC) || defined(macintosh) || defined (SYMANTEC_C)
  702.  
  703. #ifdef GOT_MACHINE
  704. If you get an error on this line more than one machine type has been defined.
  705. Please check your Makefile.
  706. #endif
  707. #define GOT_MACHINE 1
  708.  
  709. #include <memory.h>             /* malloc stuff for MPW */
  710. #include <fcntl.h>              /* unbuffered I/O stuff for MPW */
  711. #ifdef __MWERKS__                /* Metrowerks */
  712. #include <sioux.h>
  713. #include <console.h>
  714. #endif
  715. #ifdef SYMANTEC_C                /* for SYMANTEC C */
  716. #include <unix.h>
  717. #define isascii(c)  (isprint(c) || iscntrl(c))
  718. #else  /* MPW, possibly others */
  719. #include <Files.h>              /* for unbuffered I/O stuff */
  720. #endif /* SYMANTEC_C*/
  721. #ifndef ABSOFT
  722. #define DF_CAPFNAMES            /* fortran names are in all caps */
  723. #endif /* ABSOFT */
  724. #define DF_DYNAMIC              /* use dynamic allocation */
  725. #define DF_MT   DFMT_MAC
  726.  
  727. typedef void              VOID;
  728. typedef void              *VOIDP;
  729. typedef char              *_fcd;
  730. typedef char              char8;
  731. typedef unsigned char     uchar8;
  732. typedef char              int8;
  733. typedef unsigned char     uint8;
  734. typedef short int         int16;
  735. typedef unsigned short int uint16;
  736. typedef long int          int32;
  737. typedef unsigned long int uint32;
  738. typedef int               intn;
  739. typedef unsigned int      uintn;
  740. typedef float             float32;
  741. typedef double            float64;
  742. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  743. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  744. #define _fcdtocp(desc) (desc)
  745. void exit(int status);
  746.  
  747. #define FILELIB MACIO
  748.  
  749. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  750.  
  751. /* Determine the memory manager we are going to use. Valid values are: */
  752. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  753. /*  what each does */
  754. #define JMEMSYS         MEM_ANSI
  755.  
  756. #endif /*MAC*/
  757.  
  758. /* Metrowerks Mac compiler defines some PC stuff so need to exclude this on the Mac */
  759. #if !(defined(macintosh) || defined(MAC))
  760.  
  761. #if defined INTEL86 || defined M_I86 || defined M_I386 || defined DOS386 || defined __i386 || defined UNIX386
  762. #ifndef INTEL86
  763. #define INTEL86
  764. #endif /* INTEL86 */
  765.  
  766. #if !defined UNIX386 && (defined unix || defined __unix)
  767. #define UNIX386
  768. #endif /* UNIX386 */
  769.  
  770. #if !defined DOS386 && defined M_I386
  771. #define DOS386
  772. #endif /* M_I386 && !DOS386 */
  773.  
  774. #if defined _WINDOWS || defined WIN32
  775. #define WIN386
  776. #endif  /* _WINDOWS | WIN32 */
  777.  
  778. #if defined WIN386 || defined DOS386 || defined UNIX386
  779. #define INTEL386
  780. #endif /* WIN386 | DOS386 | UNIX386 */
  781.  
  782. #ifdef GOT_MACHINE
  783. If you get an error on this line more than one machine type has been defined.
  784. Please check your Makefile.
  785. #endif
  786. #define GOT_MACHINE 1
  787.  
  788. #include <fcntl.h>
  789. #ifdef UNIX386
  790. #include <sys/types.h>      /* for unbuffered file I/O */
  791. #include <sys/stat.h>
  792. #include <unistd.h>
  793. #else /* !UNIX386 */
  794. #include <sys\types.h>      /* for unbuffered file I/O */
  795. #include <sys\stat.h>
  796. #include <io.h>
  797. #include <conio.h>          /* for debugging getch() calls */
  798. #include <malloc.h>
  799. #endif /* UNIX386 */
  800. #include <ctype.h>          /* for character macros */
  801. #ifdef __WATCOMC__
  802. #include <stddef.h>         /* for the 'fortran' pragma */
  803. #endif
  804. #if defined WIN386
  805. #ifndef GMEM_MOVEABLE       /* check if windows header is already included */
  806. #include <windows.h>        /* include the windows headers */
  807. #include <winnt.h>
  808. #define HAVE_BOOLEAN
  809. #endif /* GMEM_MOVEABLE */
  810. #endif /* WIN386 */
  811.  
  812. #define DF_MT             DFMT_PC
  813.  
  814. #ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
  815. typedef void              VOID;
  816. #endif  /* end VOID */
  817. typedef void *            VOIDP;
  818. typedef char *            _fcd;
  819. typedef char              char8;
  820. typedef unsigned char     uchar8;
  821. typedef char              int8;
  822. typedef unsigned char     uint8;
  823. typedef short int         int16;
  824. typedef unsigned short int uint16;
  825. typedef long int          int32;
  826. typedef unsigned long int uint32;
  827. typedef int               intn;
  828. typedef unsigned int      uintn;
  829. typedef float             float32;
  830. typedef double            float64;
  831. typedef long              intf;     /* size of INTEGERs in Fortran compiler */
  832. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  833.  
  834. #if defined UNIX386
  835. #define FNAME_POST_UNDERSCORE
  836. #elif defined INTEL386
  837. #define DF_CAPFNAMES
  838. #endif
  839. #define _fcdtocp(desc) (desc)
  840.  
  841. #ifdef  HAVE_FMPOOL
  842. #define FILELIB PAGEBUFIO  /* enable page buffering */
  843. #else
  844. #define FILELIB UNIXBUFIO
  845. #endif
  846.  
  847. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  848.  
  849. /* Determine the memory manager we are going to use. Valid values are: */
  850. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  851. /*  what each does */
  852. #define JMEMSYS         MEM_ANSI
  853. #define HAVE_STDC
  854. #define INCLUDES_ARE_ANSI
  855.  
  856. #endif /* INTEL86 */
  857. #endif /* !(defined(macintosh) || defined(MAC)) */
  858.  
  859. #if defined(NEXT) || defined(NeXT)
  860.  
  861. #ifndef NEXT
  862. #define NEXT
  863. #endif
  864.  
  865. #ifdef GOT_MACHINE
  866. If you get an error on this line more than one machine type has been defined.
  867. Please check your Makefile.
  868. #endif
  869. #define GOT_MACHINE
  870.  
  871. #define isascii(c)  (isprint(c) || iscntrl(c))
  872. #ifndef __GNUC__
  873. #include <memory.h>
  874. #endif /* __GNUC__ */
  875. #include <sys/file.h>               /* for unbuffered i/o stuff */
  876. #include <sys/stat.h>
  877. #define DF_MT             DFMT_NEXT
  878. typedef void              VOID;
  879. typedef void              *VOIDP;
  880. typedef char              *_fcd;
  881. typedef char              char8;
  882. typedef unsigned char     uchar8;
  883. typedef char              int8;
  884. typedef unsigned char     uint8;
  885. typedef short int         int16;
  886. typedef unsigned short int uint16;
  887. typedef long int          int32;
  888. typedef unsigned long int uint32;
  889. typedef int               intn;
  890. typedef unsigned int      uintn;
  891. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  892. typedef float             float32;
  893. typedef double            float64;
  894. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  895. #define FNAME_POST_UNDERSCORE
  896. #define _fcdtocp(desc) (desc)
  897. #ifdef  HAVE_FMPOOL
  898. #define FILELIB PAGEBUFIO  /* enable page buffering */
  899. #else
  900. #define FILELIB UNIXBUFIO
  901. #endif
  902.  
  903. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  904.  
  905. /* Determine the memory manager we are going to use. Valid values are: */
  906. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  907. /*  what each does */
  908. #define JMEMSYS         MEM_ANSI
  909.  
  910. #define HAVE_STDC
  911. #define INCLUDES_ARE_ANSI
  912.  
  913. #endif /* NEXT */
  914.  
  915. #if defined(MOTOROLA) || defined(m88k)
  916.  
  917. #ifdef GOT_MACHINE
  918. If you get an error on this line more than one machine type has been defined.
  919. Please check your Makefile.
  920. #endif
  921. #define GOT_MACHINE
  922.  
  923. #ifndef __GNUC__
  924. #include <memory.h>
  925. #endif /* __GNUC__ */
  926. #include <unistd.h>
  927. #include <sys/file.h>               /* for unbuffered i/o stuff */
  928. #include <sys/stat.h>
  929. #ifndef O_RDONLY
  930. #include <fcntl.h>              /* for unbuffered i/o stuff */
  931. #endif /*O_RDONLY*/
  932. #define DF_MT             DFMT_MOTOROLA
  933. typedef void              VOID;
  934. typedef void              *VOIDP;
  935. typedef char              *_fcd;
  936. typedef char              char8;
  937. typedef unsigned char     uchar8;
  938. typedef char              int8;
  939. typedef unsigned char     uint8;
  940. typedef short int         int16;
  941. typedef unsigned short int uint16;
  942. typedef long int          int32;
  943. typedef unsigned long int uint32;
  944. typedef int               intn;
  945. typedef unsigned int      uintn;
  946. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  947. typedef float             float32;
  948. typedef double            float64;
  949. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  950. #define FNAME_POST_UNDERSCORE
  951. #define _fcdtocp(desc) (desc)
  952. #define FILELIB UNIXBUFIO
  953.  
  954. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  955.  
  956. /* Determine the memory manager we are going to use. Valid values are: */
  957. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  958. /*  what each does */
  959. #define JMEMSYS         MEM_ANSI
  960.  
  961. #endif /* MOTOROLA */
  962.  
  963. #if defined DEC_ALPHA || (defined __alpha && defined __unix__)
  964.  
  965. #ifndef DEC_ALPHA
  966. #define DEC_ALPHA
  967. #endif
  968.  
  969. #ifdef GOT_MACHINE
  970. If you get an error on this line more than one machine type has been defined.
  971. Please check your Makefile.
  972. #endif
  973. #define GOT_MACHINE
  974.  
  975. #include <sys/file.h>               /* for unbuffered i/o stuff */
  976. #include <sys/stat.h>
  977. #define DF_MT             DFMT_ALPHA
  978. typedef void              VOID;
  979. typedef void              *VOIDP;
  980. typedef char              *_fcd;
  981. typedef char              char8;
  982. typedef unsigned char     uchar8;
  983. typedef char              int8;
  984. typedef unsigned char     uint8;
  985. typedef short int         int16;
  986. typedef unsigned short int uint16;
  987. #ifndef __rpc_types_h
  988. typedef int               int32;
  989. typedef unsigned int      uint32;
  990. #endif /* __rpc_types_h */
  991. typedef int               intn;
  992. typedef unsigned int      uintn;
  993. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  994. typedef float             float32;
  995. typedef double            float64;
  996. typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
  997. #define FNAME_POST_UNDERSCORE
  998. #define _fcdtocp(desc) (desc)
  999. #ifdef  HAVE_FMPOOL
  1000. #define FILELIB PAGEBUFIO  /* enable page buffering */
  1001. #else
  1002. #define FILELIB UNIXBUFIO
  1003. #endif
  1004.  
  1005. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  1006.  
  1007. /* Determine the memory manager we are going to use. Valid values are: */
  1008. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  1009. /*  what each does */
  1010. #define JMEMSYS         MEM_ANSI
  1011.  
  1012. #ifdef __GNUC__
  1013. #define HAVE_STDC
  1014. #define INCLUDES_ARE_ANSI
  1015. #endif
  1016.  
  1017. #endif /* DEC_ALPHA */
  1018.  
  1019. #if defined VP | defined __uxpm__
  1020.  
  1021. #ifndef VP
  1022. #define VP
  1023. #endif
  1024.  
  1025. #ifdef GOT_MACHINE
  1026. If you get an error on this line more than one machine type has been defined.
  1027. Please check your Makefile.
  1028. #endif
  1029. #define GOT_MACHINE 1
  1030.  
  1031. #include <memory.h>
  1032. #include <sys/types.h>
  1033. #include <sys/stat.h>
  1034. #define DF_MT              DFMT_VP
  1035. typedef void                VOID;
  1036. typedef void               *VOIDP;
  1037. typedef char               *_fcd;
  1038. typedef char               char8;
  1039. typedef unsigned char      uchar8;
  1040. typedef char               int8;
  1041. typedef unsigned char      uint8;
  1042. typedef short int          int16;
  1043. typedef unsigned short int uint16;
  1044. typedef long int           int32;
  1045. typedef unsigned long int  uint32;
  1046. typedef int                intn;
  1047. typedef unsigned int       uintn;
  1048. typedef int                intf;     /* size of INTEGERs in Fortran compiler */
  1049. typedef float              float32;
  1050. typedef double             float64;
  1051. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  1052. #define FNAME_POST_UNDERSCORE
  1053. #define _fcdtocp(desc) (desc)
  1054. #define FILELIB UNIXBUFIO
  1055.  
  1056. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  1057.  
  1058. /* Determine the memory manager we are going to use. Valid values are: */
  1059. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  1060. /*  what each does */
  1061. #define JMEMSYS         MEM_ANSI
  1062.  
  1063. #endif /* VP */
  1064.  
  1065. #if defined I860 | defined i860
  1066.  
  1067. #ifndef I860
  1068. #define I860
  1069. #endif
  1070.  
  1071. #ifdef GOT_MACHINE
  1072. If you get an error on this line more than one machine type has been defined.
  1073. Please check your Makefile.
  1074. #endif
  1075. #define GOT_MACHINE 1
  1076.  
  1077. #include <sys/types.h>
  1078. #include <sys/file.h>           /* for unbuffered i/o stuff */
  1079. #include <sys/stat.h>
  1080. #include <unistd.h>             /* mis-using def. for SEEK_SET, but oh well */
  1081. #define DF_MT   DFMT_I860
  1082. typedef void            VOID;
  1083. typedef void            *VOIDP;
  1084. typedef char            *_fcd;
  1085. typedef char            char8;
  1086. typedef unsigned char   uchar8;
  1087. typedef char            int8;
  1088. typedef unsigned char   uint8;
  1089. typedef short           int16;
  1090. typedef unsigned short  uint16;
  1091. typedef int             int32;
  1092. typedef unsigned int    uint32;
  1093. typedef int             intn;
  1094. typedef unsigned int    uintn;
  1095. typedef float           float32;
  1096. typedef double          float64;
  1097. typedef int             intf;     /* size of INTEGERs in Fortran compiler */
  1098. typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
  1099. #define _fcdtocp(desc) (desc)
  1100. #define FNAME_POST_UNDERSCORE
  1101. #define FILELIB UNIXBUFIO
  1102.  
  1103. /* JPEG #define's - Look in the JPEG docs before changing - (Q) */
  1104.  
  1105. /* Determine the memory manager we are going to use. Valid values are: */
  1106. /*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
  1107. /*  what each does */
  1108. #define JMEMSYS         MEM_ANSI
  1109.  
  1110. #endif /* I860 */
  1111.  
  1112. #ifndef GOT_MACHINE
  1113. No machine type has been defined.  Your Makefile needs to have someing like
  1114. -DSUN or -DUNICOS in order for the HDF internal structures to be defined
  1115. correctly.
  1116. #endif
  1117.  
  1118. /*-----------------------------------------------------*/
  1119. /*              encode and decode macros               */
  1120. /*-----------------------------------------------------*/
  1121.  
  1122. #   define INT16ENCODE(p, i) \
  1123. { *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; \
  1124.         *(p) = (uint8)((uintn)(i) & 0xff); (p)++; }
  1125.  
  1126. #   define UINT16ENCODE(p, i) \
  1127. { *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; *(p) = (uint8)((i) & 0xff); (p)++; }
  1128.  
  1129. #   define INT32ENCODE(p, i) \
  1130. { *(p) = (uint8)(((uint32)(i) >> 24) & 0xff); (p)++; \
  1131.         *(p) = (uint8)(((uint32)(i) >> 16) & 0xff); (p)++; \
  1132.         *(p) = (uint8)(((uint32)(i) >> 8) & 0xff); (p)++; \
  1133.         *(p) = (uint8)((uint32)(i) & 0xff); (p)++; }
  1134.  
  1135. #   define UINT32ENCODE(p, i) \
  1136. { *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \
  1137.         *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \
  1138.         *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \
  1139.         *(p) = (uint8)((i) & 0xff); (p)++; }
  1140.  
  1141. #   define NBYTEENCODE(d, s, n) \
  1142. {   HDmemcpy(d,s,n); p+=n }
  1143.  
  1144. /* DECODE converts big endian bytes pointed by p to integer values and store
  1145.  * it in i.  For signed values, need to do sign-extension when converting
  1146.  * the 1st byte which carries the sign bit.
  1147.  * The macros does not require i be of a certain byte sizes.  It just requires
  1148.  * i be big enough to hold the intended value range.  E.g. INT16DECODE works
  1149.  * correctly even if i is actually a 64bit int like in a Cray.
  1150.  */
  1151.  
  1152. #   define INT16DECODE(p, i) \
  1153. { (i) = ((*(p) & 0x80) ? ~0xffff : 0x00) | ((int16)(*(p) & 0xff) << 8); (p)++; \
  1154.         (i) |= (int16)((*(p) & 0xff)); (p)++; }
  1155.  
  1156. #   define UINT16DECODE(p, i) \
  1157. { (i) = (uint16)((*(p) & 0xff) << 8); (p)++; \
  1158.         (i) |= (uint16)(*(p) & 0xff); (p)++; }
  1159.  
  1160. #   define INT32DECODE(p, i) \
  1161. { (i) = ((*(p) & 0x80) ? ~0xffffffff : 0x00) | ((int32)(*(p) & 0xff) << 24); (p)++; \
  1162.         (i) |= ((int32)(*(p) & 0xff) << 16); (p)++; \
  1163.         (i) |= ((int32)(*(p) & 0xff) << 8); (p)++; \
  1164.         (i) |= (*(p) & 0xff); (p)++; }
  1165.  
  1166. #   define UINT32DECODE(p, i) \
  1167. { (i) = ((uint32)(*(p) & 0xff) << 24); (p)++; \
  1168.         (i) |= ((uint32)(*(p) & 0xff) << 16); (p)++; \
  1169.         (i) |= ((uint32)(*(p) & 0xff) << 8); (p)++; \
  1170.         (i) |= (uint32)(*(p) & 0xff); (p)++; }
  1171.  
  1172. /* Note! the NBYTEDECODE macro is backwards from the memcpy() routine, */
  1173. /*      in the spirit of the other DECODE macros */
  1174. #   define NBYTEDECODE(s, d, n) \
  1175. {   HDmemcpy(d,s,n); p+=n }
  1176.  
  1177. /**************************************************************************
  1178. *                   Conversion Routine Pointers
  1179. ***************************************************************************/
  1180. #    ifndef DFKMASTER
  1181. extern int (*DFKnumin)(const void * source, void * dest, uint32 num_elm,
  1182.             uint32 source_stride,uint32 dest_stride);
  1183. extern int (*DFKnumout)(const void * source, void * dest, uint32 num_elm,
  1184.             uint32 source_stride,uint32 dest_stride);
  1185. #     endif /* DFKMASTER */
  1186.  
  1187. /*----------------------------------------------------------------
  1188. ** MACRO FCALLKEYW for any special fortran-C stub keyword
  1189. **
  1190. ** MacIntosh MPW LS-fortran needs pascal since it can interface
  1191. **  best with pascal functions.
  1192. ** Microsoft C and Fortran need __fortran for Fortran callable C
  1193. **  routines.
  1194. **
  1195. ** MACRO FRETVAL for any return value from a fortran-C stub function
  1196. **  Replaces the older FCALLKEYW macro.
  1197. **---------------------------------------------------------------*/
  1198. #ifdef FRETVAL
  1199. #undef FRETVAL
  1200. #endif
  1201.  
  1202. #if defined(MAC)                /* with LS FORTRAN */
  1203. #ifndef ABSOFT
  1204. #   define FCALLKEYW    pascal
  1205. #   define FRETVAL(x)   pascal x
  1206. #endif /* ABSOFT */
  1207. #endif
  1208.  
  1209. #ifndef FRETVAL /* !MAC */
  1210. #   define FCALLKEYW    /*NONE*/
  1211. #   define FRETVAL(x)   x
  1212. #endif
  1213.  
  1214.  
  1215. /*----------------------------------------------------------------
  1216. ** MACRO FNAME for any fortran callable routine name.
  1217. **
  1218. **  This macro prepends, appends, or does not modify a name
  1219. **  passed as a macro parameter to it based on the FNAME_PRE_UNDERSCORE,
  1220. **  FNAME_POST_UNDERSCORE macros set for a specific system.
  1221. **
  1222. **---------------------------------------------------------------*/
  1223. #if defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE)
  1224. #   define FNAME(x)     _##x##_
  1225. #endif
  1226. #if defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE)
  1227. #   define FNAME(x)     _##x
  1228. #endif
  1229. #if !defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE)
  1230. #   define FNAME(x)     x##_
  1231. #endif
  1232. #if !defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE)
  1233. #   define FNAME(x)     x
  1234. #endif
  1235.  
  1236. /**************************************************************************
  1237. *  Generally useful macro definitions
  1238. **************************************************************************/
  1239. #ifndef MIN
  1240. #define MIN(a,b)    (((a)<(b)) ? (a) : (b))
  1241. #endif
  1242. #ifndef MAX
  1243. #define MAX(a,b)    (((a)>(b)) ? (a) : (b))
  1244. #endif
  1245.  
  1246. /**************************************************************************
  1247. *  Debugging Allocation functions
  1248. **************************************************************************/
  1249. #ifdef MALDEBUG
  1250. #include "maldebug.h"
  1251. #endif
  1252.  
  1253. /**************************************************************************
  1254. *  Macros to work around ANSI C portability problems.
  1255. **************************************************************************/
  1256. #ifdef DUMBCC
  1257. #define CONSTR(v,s) char *v=s
  1258. #else
  1259. #define CONSTR(v,s) static const char v[]=s
  1260. #endif
  1261.  
  1262. /* Old-style memory allocation function aliases -QAK */
  1263. #define HDgetspace HDmalloc
  1264. #define HDclearspace HDcalloc
  1265. #define HDregetspace HDrealloc
  1266. #define HDfreespace HDfree
  1267.  
  1268. /**************************************************************************
  1269. *  Allocation functions defined differently 
  1270. **************************************************************************/
  1271. #if !defined MALLOC_CHECK
  1272. #  define HDmalloc(s)      (malloc((size_t)s))
  1273. #  define HDcalloc(a,b)    (calloc((size_t)a,(size_t)b))
  1274. #  define HDfree(p)        (free((void*)p))
  1275. #  define HDrealloc(p,s)   (realloc((void*)p,(size_t)s))
  1276. #endif /* !defined MALLOC_CHECK */
  1277. /* Macro to free space and clear pointer to NULL */
  1278. #define HDfreenclear(p) { if((p)!=NULL) HDfree(p); p=NULL; }
  1279.  
  1280. /**************************************************************************
  1281. *  String functions defined differently 
  1282. **************************************************************************/
  1283.  
  1284. #  define HDstrcat(s1,s2)   (strcat((s1),(s2)))
  1285. #  define HDstrcmp(s,t)     (strcmp((s),(t)))
  1286. #  define HDstrcpy(s,d)     (strcpy((s),(d)))
  1287. #  define HDstrlen(s)       (strlen((const char *)(s)))
  1288. #  define HDstrncmp(s1,s2,n)    (strncmp((s1),(s2),(n)))
  1289. #  define HDstrncpy(s1,s2,n)    (strncpy((s1),(s2),(n)))
  1290. #  define HDstrchr(s,c)         (strchr((s),(c)))
  1291. #  define HDstrrchr(s,c)        (strrchr((s),(c)))
  1292. #  define HDstrtol(s,e,b)       (strtol((s),(e),(b)))
  1293. /* non-standard function, not defined on the following machines - */
  1294. #if !(defined VMS || defined macintosh || defined MAC || defined SYMANTEC_C || defined MIPSEL || defined NEXT || defined CONVEX || defined IBM6000 || defined ANSISUN || defined IRIX)
  1295. #  define HDstrdup(s)      ((char *)strdup((const char *)(s)))
  1296. #endif /* !(VMS | etc..) */
  1297.  
  1298.  
  1299. /**************************************************************************
  1300. *  Memory functions defined differently
  1301. **************************************************************************/
  1302.  
  1303. # define HDmemcpy(dst,src,n)   (memcpy((void *)(dst),(const void *)(src),(size_t)(n)))
  1304. # define HDmemset(dst,c,n)     (memset((void *)(dst),(intn)(c),(size_t)(n)))
  1305. # define HDmemcmp(dst,src,n)   (memcmp((const void *)(dst),(const void *)(src),(size_t)(n)))
  1306.  
  1307.  
  1308. /**************************************************************************
  1309. *  Misc. functions
  1310. **************************************************************************/
  1311. #if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
  1312. #define HDstat(path, result)    (mstat(path))
  1313. #else /* !macintosh */
  1314. #define HDstat(path, result)    (stat(path, result))
  1315. #endif /* !macintosh */
  1316. #define HDgetenv(s1)            (getenv(s1))
  1317. #define HDputenv(s1)            (putenv(s1))
  1318. #define HDltoa(v)               (ltoa(v))
  1319. #if defined (SUN) && defined(__GNUC__)
  1320. #define HDatexit(f)             (0) /* we punt on the SUN using gcc */
  1321. #else /* !SUN & GCC */
  1322. #define HDatexit(f)             (atexit(f))
  1323. #endif /* !SUN & GCC */
  1324.  
  1325. /* Compatibility #define for V3.3, should be taken out by v4.0 - QAK */
  1326. #define DFSDnumber DFSDndatasets
  1327.  
  1328. #endif /* HDFI_H */
  1329.  
  1330.